<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>108Wo室内设计数据资源中心 - 我的栏目</title>
<link href="{CSS_PATH}108wo/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{JS_PATH}108wo/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var cats = {$cats_json};
$(function(){
	$("#catid_1").change(function(){
		var catid_1 = this.value;
		var html="";
		for(i in cats) {
			if(cats[i].catid == catid_1) {
				for(j in cats[i].child) {
					html += "<option value='"+cats[i].child[j].catid+"'>"+cats[i].child[j].catname+"</option>";
				}
				$("#catid_2").html(html);
			}
		}
	});
	
	$('#createForm').submit(function(){
		$('#msgBox').fadeIn("fast")
		if($.trim($("#info_name").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入栏目名称</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_name").focus();
			return false;
		}
		if($.trim($("#info_prealname").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系人</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_prealname").focus();
			return false;
		}
		if($.trim($("#info_pqq").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系QQ</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_pqq").focus();
			return false;
		}
		if($.trim($("#info_paddress").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系地址</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_paddress").focus();
			return false;
		}
		if($.trim($("#info_ptel").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系电话</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_ptel").focus();
			return false;
		}
		
		$('#msgBox').html("<div class='loading'>更新中，请稍后...</div>");
		$.post($(this).attr('action'), $(this).serializeArray(), function(data){
			if(data == "操作成功！")
			{
				//parent.$('#fancybox-close').click();
				setTimeout(function(){$('#msgBox').html("<div class='suc'>修改栏目成功...</div>");},500);
				setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
				setTimeout(function(){top.location.reload();},1200);
			}				
			else{
				$('#msgBox').html("<div class='err'>"+data+"</div>");
				setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			}
		});

		return false;
	});
	
})
</script>
</head>
<body style="background:none">
<div id="msgBox"></div>
<div id="createList">
	<h1>编辑栏目</h1>		
	<ul>
		<form action="{APP_PATH}index.php?m=brand&c=index&a=edit&id={$brand[id]}" method="POST" id="createForm">
		<table cellpadding="0" cellspacing="0">
			<tr>
				<td width="30%" align="right"><span style="color:red;">*</span>上级栏目</td>
				<td>
					{$brand[top_catname]}
                	<!-- <select name="info[catid_1]" id="catid_1">
                	{loop $cats $v}
                	<option value='{$v[catid]}' {if $cat_1['catid']==$v['catid']}selected{/if}>{$v[catname]}</option>
                	{/loop}
                	</select>
				<select name="info[catid_2]" id="catid_2">
				{loop $cats $v}
					{if $v[catid] == $cat_1[catid]}
						{loop $v[child] $v2}
							<option value='{$v2[catid]}' {if $cat_2[catid]==$v2[catid]} selected{/if}>{$v2[catname]}</option>
						{/loop}
					{/if}
				{/loop}
				</select> -->
                </td>
			</tr>
			<tr>
				<td align="right"><span style="color:red;">*</span>栏目名称</td>
				<td><input type="text" name="info[name]" id="info_name" value="{$brand[name]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right">供应商名称</td>
				<td><input type="text" name="info[pcompanyname]" id="info_pcompanyname" value="{$brand[pcompanyname]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>联系人</td>
				<td><input type="text" name="info[prealname]" id="info_prealname" value="{$brand[prealname]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>QQ</td>
				<td><input type="text" name="info[pqq]" id="info_pqq" value="{$brand[pqq]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>联系地址</td>
				<td><input type="text" name="info[paddress]" id="info_paddress" value="{$brand[paddress]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>联系电话</td>
				<td><input type="text" name="info[ptel]" id="info_ptel" value="{$brand[ptel]}" size="32" /></td>
			</tr>
			<tr>
				<td align="right">&nbsp;</td>
				<td><button type="submit">确 认</button></td>
			</tr>
		</table>
		<input type="hidden" name="dosubmit" value="1" />
		<input type="hidden" name="doajax" value="1" />
		</form>
	</ul>
</div>
</body>
</html>
